<?php
class ome_desktop_widgets_service_delivery{

    public function get_menugroup(){
        $status_cfg = app::get('ome')->getConf('ome.delivery.status.cfg');
        $deliveryObj = &app::get('ome')->model('delivery');
        $data['label'] = '发货单';
        $data['type'] = 'delivery';
        if($status_cfg == '' || ($status_cfg['set']['stock'] == 1 && $status_cfg['set']['delie'] == 1 )){
            $data['value']['0']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'stock_status'=>'false','deliv_status'=>'false','expre_status'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['0']['label'] = '待打印';
            $data['value']['1']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'stock_status'=>'true','deliv_status'=>'true','expre_status'=>'true','verify'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['1']['label'] = '待校验';
            $data['value']['2']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'stock_status'=>'true','deliv_status'=>'true','expre_status'=>'true','verify'=>'true','process'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['2']['label'] = '待发货';
        }
        if($status_cfg['set']['stock'] == 1 && $status_cfg['set']['delie'] == 0 ){
            $data['value']['0']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'stock_status'=>'false','expre_status'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['0']['label'] = '待打印';
            $data['value']['1']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'stock_status'=>'true','expre_status'=>'true','verify'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['1']['label'] = '待校验';
            $data['value']['2']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'stock_status'=>'true','expre_status'=>'true','verify'=>'true','process'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['2']['label'] = '待发货';
        }
        if($status_cfg['set']['stock'] == 0 && $status_cfg['set']['delie'] == 1 ){
            $data['value']['0']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'deliv_status'=>'false','expre_status'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['0']['label'] = '待打印';
            $data['value']['1']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'deliv_status'=>'true','expre_status'=>'true','verify'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['1']['label'] = '待校验';
            $data['value']['2']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'deliv_status'=>'true','expre_status'=>'true','verify'=>'true','process'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['2']['label'] = '待发货';
        }
        if($status_cfg['set']['stock'] == 0 && $status_cfg['set']['delie'] == 0 ){
            $data['value']['0']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'expre_status'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['0']['label'] = '待打印';
            $data['value']['1']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'expre_status'=>'true','verify'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['1']['label'] = '待校验';
            $data['value']['2']['count'] = $deliveryObj->count(array('parent_id'=>'0','status'=> array('ready','progress','succ'),
                'expre_status'=>'true','verify'=>'true','process'=>'false','pause'=>'false','disabled'=>'false'));
            $data['value']['2']['label'] = '待发货';
        }
        return $data;
    }
}